import request from "@/utils/request";

//传图文消息内的图片获取URL
export function newsImgUpload(query) {
  return request({
    url: "/wxmaterial/newsImgUpload",
    method: "post",
    data: query,
  });
}
//上传封面
export function materialFileUpload(obj) {
  return request({
    url: "/wxmaterial/materialFileUpload",
    method: "post",
    data: obj,
  });
}
//发布文章
export function publishArticle(obj) {
  return request({
    url: `/news-info/publish/${obj.id}?mediaId=${obj.mediaId}`,
    method: "post",
  });
}

export function listByPage(obj) {
  return request({
    url: "/news-info/listByPage",
    method: "post",
    data: obj,
  });
}
//新增草稿文章
export function addDraft(obj) {
  return request({
    url: "/news-info/addDraft",
    method: "post",
    data: obj,
  });
}

//新增草稿文章
export function edit(obj) {
  return request({
    url: "/news-info/edit",
    method: "put",
    data: obj,
  });
}

//新增草稿文章
export function deleteById(obj) {
  return request({
    url: `/news-info/delete/${obj.id}`,
    method: "delete",
  });
}
//新增草稿文章
export function addArticle(data) {
  return request({
    url: '/news-info/addArticle',
    method: "post",
    data:data,
  });
}

